using DataTestFramework.NHibernate.Models;

using FluentNHibernate.Mapping;

using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;


namespace DataTestFramework.NHibernate.Mappers
{
    public class NhOrderDetailMapping : ClassMap<NhOrderDetail>
    {
        public NhOrderDetailMapping()
        {
            Table("OrderDetails");
            Id(m => m.DetailId).GeneratedBy.Identity();
            Map(m => m.UnitPrice);
            Map(m => m.Quantity);
            Map(m => m.ProductId);
            Map(m => m.OrderId);
            References(m => m.Product).Column("ProductId").ForeignKey("ProductId").LazyLoad();
            References(m => m.Order).Column("OrderId").ForeignKey("OrderId").LazyLoad();
        }
    }
}
